<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/static/common/default.jsp"%>

<!DOCTYPE html>
<html lang="en">
	 <head>
	 <jsp:include page="/style/header.jsp"></jsp:include>
	 </head>
	
	<body>
	<div class="title_bar">
        <h3>我的申请</h3>
        <!--<a href="javascript:history.go(-1);" class="go_back"></a>-->
    </div>
	
	<!-- tab切换 -->
    <div id="segmentedControl" class="mui-segmented-control mui-segmented-control-inverted mui-segmented-control-primary">
        <a class="mui-control-item" href="#item1">用工审批</a>
        <a class="mui-control-item" href="#item2">机械审批</a>
    </div>
    
    <div class="mui-control-content apply_list ">
    <c:forEach var="emres" items="${empoyResults.data}">
    	<a href="javascript:forwardemploy(${emres.applyId},${user.user_id})" class="<c:choose><c:when test="${emres.state==0}">cell arrow_right waiting</c:when><c:when test="${emres.state==3||emres.state==4||emres.state==5}">cell arrow_right applying</c:when><c:when test="${emres.state==-3||emres.state==-4||emres.state==-5||emres.state==-6}">cell arrow_right not_pass</c:when><c:when test="${emres.state==6}">cell arrow_right pass</c:when></c:choose>">
            <div class="icon"><i></i></div>
            <div class="title">签证编号:${emres.visaCode}
                <span class="status"><i></i>
                <c:choose>
                <c:when test="${emres.state==0}">已发起</c:when>
                <c:when test="${emres.state==3||emres.state==4||emres.state==5}">审批中</c:when>
                <c:when test="${emres.state==-3||emres.state==-4||emres.state==-5||emres.state==-6}">已作废</c:when>
                <c:when test="${emres.state==6}">已完成</c:when>
                </c:choose>
                </span></div>
            <div class="title">申请类型:用工申请 </div>
            <div class="title">项目:${emres.project.name} </div>
            <div class="info">申请内容: ${emres.applyContent}</div>
            <!-- <div class="info">申请时间:<fmt:formatDate value="${emres.applyTime}" type="both" pattern="yyyy-MM-dd HH:mm"/> </div> -->
        </a>
    	</c:forEach>
	</div>
	
	<div class="mui-control-content apply_list mui-active">
	<c:forEach var="mares" items="${mechanResult.data}">
    	<a href="javascript:forward(${mares.applyId},${user.user_id})" class="<c:choose><c:when test="${mares.state==0}">cell arrow_right waiting</c:when><c:when test="${mares.state==3||mares.state==4||mares.state==5}">cell arrow_right applying</c:when><c:when test="${mares.state==-3||mares.state==-4||mares.state==-5||mares.state==-6}">cell arrow_right not_pass</c:when><c:when test="${mares.state==6}">cell arrow_right pass</c:when></c:choose>">
            <div class="icon"><i></i></div>
            <div class="title">签证编号:${mares.visaCode}
                <span class="status"><i></i>
                <c:choose>
                <c:when test="${mares.state==0}">已发起</c:when>
                <c:when test="${mares.state==3||mares.state==4||mares.state==5}">审批中</c:when>
                <c:when test="${mares.state==-3||mares.state==-4||mares.state==-5||mares.state==-6}">已作废</c:when>
                <c:when test="${mares.state==6}">已完成</c:when>
                </c:choose>
                </span></div>
            <div class="title">申请类型:机械申请 </div>
            <div class="title">项目:${mares.project.name} </div>
            <div class="info">申请内容: ${mares.applyContent}</div>
            <!-- <div class="info">申请时间:<fmt:formatDate value="${mares.applyTime}" type="both" pattern="yyyy-MM-dd HH:mm"/> </div> -->
        </a>
    </c:forEach>
    </div>
    
    
    <jsp:include page="/style/footer.jsp"></jsp:include>
     <script>
	 	$('.mui-control-item').bind('tap',function() {
	         var index = $('.mui-control-item').index($(this));
	         setCookie('shenpi_index', index,0.5);
	         $('.mui-control-item, .mui-control-content').removeClass('mui-active');
	         $('.mui-control-content').eq(index).addClass('mui-active');
	         $(this).addClass('mui-active');
	    })
	 	$('.mui-control-item').eq(getCookie('shenpi_index')).trigger('tap');
		 
    	function forward(applyId,userId){
    		window.location.href = "${ctx}/mechanicalApply/view/"+applyId+"/"+userId;
    	}
    	
    	function forwardemploy(applyId,userId){
    		window.location.href = "${ctx}/wemployapply/wxgetemploy?applyId="+applyId+"&userId="+userId;
    	}
    </script>
	</body>
</html>